# -*- coding: utf-8 -*-
# @Time    : 2020/3/17 上午10:04
# @Author  : lilong

"""
# 模板1
（1）实现过滤的细节
（2）使用filter、lambda过滤
"""


class FilterScreen:
    """过滤网"""

    def doFilter(self, rawMaterials):
        for material in rawMaterials:
            if (material == "豆渣"):
                rawMaterials.remove(material)
        return rawMaterials


def FilterScreen():
    rawMaterials = ["豆浆", "豆渣"]
    print("过滤前：", rawMaterials)
    filter = FilterScreen()
    filteredMaterials = filter.doFilter(rawMaterials)
    print("过滤后：", filteredMaterials)


def Filter():
    rawMaterials = ["豆浆", "豆渣"]
    print("过滤前：", rawMaterials)
    filteredMaterials = list(filter(lambda material: material == "豆浆", rawMaterials))
    print("过滤后：", filteredMaterials)


def isSoybeanMilk(material):
    return material == "豆浆"


if __name__ == '__main__':
    FilterScreen()
    Filter()
